
# 品牌管理
# 参数：　jwt token
#        page
#        page_size

#　响应：
# {
#     "counts": "品牌总数量",
#     "lists": [
#         {
#             "id": "品牌ID",
#             "name": "品牌名称",
#             "logo": "logo图片地址",
#             "first_letter": "品牌首字母",
#          　
#         },
#         ...
#     ],
#     "page": "页码",
#     "pages": "总页数",
#     "pagesize": "页容量"
# }
from rest_framework.generics import ListAPIView
from rest_framework.permissions import IsAdminUser
from rest_framework.response import Response
from rest_framework.viewsets import ModelViewSet

from goods.models import Brand
from meiduo_admin.serializers.brands import BrandsSerialiser




# GET  /goods/brands/?page=1&pagesize=10 404 (Not Found)

class BrandsViewSet(ModelViewSet):

    permission_classes = [IsAdminUser]
    queryset=Brand.objects.all()
    serializer_class = BrandsSerialiser




#新增品牌


#获取图片路径
#上传到fasdfs

    #
    # def creat(self,request):
    #     instance = self.get_object()
    #     serializer =BrandsSerialiser(instance,data=request.data)
    #     serializer.is_valid()
    #     serializer.save()
    #     return Response(serializer.data)